--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Commit 316aa4e55616471463e22732a0d9cb42eac8d1f5
Parents : 29b12ac
Author : Sudo-Ivan <ivan@quad4.io>
Signature : Signature validation error
Date : 2026-01-01T23:56:52-06:00
feat(flatpak): add script for building and packaging Reticulum MeshChatX with Node.js and Electron dependencies
Changes
Diff
diff --git a/flatpak-build.sh b/flatpak-build.sh
new file mode 100755
index 00000000..bb639dc6
--- /dev/null
+++ b/flatpak-build.sh
@@ -0,0 +1,93 @@
+#!/bin/bash
+set -e
+
+export HOME=/tmp/build
+export XDG_CONFIG_HOME=/tmp/build/.config
+export XDG_DATA_HOME=/tmp/build/.local/share
+mkdir -p /tmp/build/.config /tmp/build/.local/share
+
+NODE_PATHS=(
+ "/usr/lib/sdk/node20/bin"
+ "/usr/lib/sdk/node20/root/usr/bin"
+ "/usr/lib/sdk/node/bin"
+ "/usr/lib/sdk/node/root/usr/bin"
+)
+
+NODE_BIN=""
+NPM_BIN=""
+
+for path in "${NODE_PATHS[@]}"; do
+ if [ -f "$path/node" ] && [ -f "$path/npm" ]; then
+ NODE_BIN="$path/node"
+ NPM_BIN="$path/npm"
+ export PATH="$path:$PATH"
+ break
+ fi
+done
+
+if [ -z "$NODE_BIN" ] || [ -z "$NPM_BIN" ]; then
+ if command -v node >/dev/null 2>&1 && command -v npm >/dev/null 2>&1; then
+ NODE_BIN=$(command -v node)
+ NPM_BIN=$(command -v npm)
+ else
+ echo "Error: Node.js binaries not found. Checking common locations..."
+ find /usr/lib/sdk -name node -type f 2>/dev/null | head -1
+ find /usr/lib/sdk -name npm -type f 2>/dev/null | head -1
+ exit 1
+ fi
+fi
+
+echo "Using Node.js: $NODE_BIN"
+echo "Using npm: $NPM_BIN"
+
+$NPM_BIN install -g pnpm@10.0.0
+
+python3 scripts/sync_version.py
+
+pnpm install --frozen-lockfile
+pnpm run build
+
+mkdir -p /tmp/electron-install
+cd /tmp/electron-install
+pnpm init
+pnpm add electron@39.2.7
+cd -
+
+pip3 install poetry
+poetry install --no-dev
+poetry run python cx_setup.py build
+
+mkdir -p /app/bin /app/lib/reticulum-meshchatx /app/share/applications /app/share/icons/hicolor/512x512/apps
+
+cp -r electron /app/lib/reticulum-meshchatx/
+cp -r build/exe /app/lib/reticulum-meshchatx/
+mkdir -p /app/lib/reticulum-meshchatx/electron-bin
+cp -r /tmp/electron-install/node_modules/electron/* /app/lib/reticulum-meshchatx/electron-bin/
+cp logo/logo.png /app/share/icons/hicolor/512x512/apps/com.sudoivan.reticulummeshchat.png
+
+cat > /app/share/applications/com.sudoivan.reticulummeshchat.desktop <<'EOF'
+[Desktop Entry]
+Type=Application
+Name=Reticulum MeshChatX
+Comment=A simple mesh network communications app powered by the Reticulum Network Stack
+Exec=reticulum-meshchatx
+Icon=com.sudoivan.reticulummeshchat
+Categories=Network;InstantMessaging;
+StartupNotify=true
+EOF
+
+cat > /app/bin/reticulum-meshchatx <<'EOF'
+#!/bin/sh
+export ELECTRON_IS_DEV=0
+export APP_PATH=/app/lib/reticulum-meshchatx/electron
+export EXE_PATH=/app/lib/reticulum-meshchatx/build/exe/ReticulumMeshChatX
+ELECTRON_BIN=/app/lib/reticulum-meshchatx/electron-bin/dist/electron
+if [ ! -f "$ELECTRON_BIN" ]; then
+ ELECTRON_BIN=$(find /app/lib/reticulum-meshchatx/electron-bin -name electron -type f 2>/dev/null | head -1)
+fi
+cd /app/lib/reticulum-meshchatx/electron
+exec "$ELECTRON_BIN" . "$@"
+EOF
+
+chmod +x /app/bin/reticulum-meshchatx
+
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────